package com.pagepub.core.tag.message;

import java.io.Serializable;

import com.pagepub.core.utils.SystemCfgHelper;


/**
 * 功能：本类主要用在servlet或struts action的forward到jsp端有信息输出所用的相关信息
 * @author ggd
 */
public class HtmlMessageBox implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String[] forwardUrl;//指定转向的url,至少有一个url,如多个时在第0个标为timer设置自动转向的默认路径

	private String message;
	private String targetName=TARGETTYPE_SELF;
	private boolean useResource=false;
	private int timer=5;
	private String[] linkMsg;//显示链接的文字信息,至少有一个链接的文字信息，必须与forwardUrl的数量、顺序一样

	private boolean isEnabledTimer=false;
	private Object[]formatParams;//打印消息格式化的具体的对象值

	private String resourceName = SystemCfgHelper.getDefaultResource();//指定资源文件名称,useResource=true时有用，如果没有指定默认为systemCfg.xml中key="defaultResource"
	private String messageOnPageURL;//消息在指定的URL页面上显示,如果有指定messageOnPage(URL)的话
	private int messageOnPageType=3;//如果没有messageOnPageURL等于null或""则messageOnPageType指定=1无效(如下引用MESSAGE_ON_PAGE开头的常量)
	
	public static final int MESSAGE_ON_PAGE_PREACTION_URL=1;//信息在引用上个动作的url的页面上显示
	public static final int MESSAGE_ON_PAGE_SPECIFY_URL=2;//信息指定url页面上显示

	public static final int MESSAGE_ON_PAGE_NONE_URL=3;//信息在单独的页面上显示

	
	
	
	public static final String TARGETTYPE_SELF = "_self";
	public static final String TARGETTYPE_BLANK = "_blank";
	public static final String TARGETTYPE_TOP = "_top";
	public static final String TARGETTYPE_PARENT = "_parent";
	public static final String MESSAGE_PAGES_ATTRIBUTE_NAME="hmb";
	public static final String MESSAGE_PAGES_CONTENT="messagebox.content";
	
	/**
	 * @return Returns the formatParams.
	 */
	public Object[] getFormatParams()
	{
		return formatParams;
	}
	/**
	 * @param formatParams The formatParams to set.
	 */
	public void setFormatParams(Object[] formatParams)
	{
		this.formatParams=formatParams;
	}
	public HtmlMessageBox()
	{
		useResource=false;
	}

	public String[] getForwardUrl()
	{
		return forwardUrl;
	}

	public String getMessage()
	{
		return message;
	}

	public String getTargetName()
	{
		return targetName;
	}


	/**
	 * 排在第一个的url是默认的
	 * @param forwardUrl
	 */
	public void setForwardUrl(String... forwardUrl)
	{
		this.forwardUrl = forwardUrl;
	}

	public void setTargetName(String targetName)
	{
		this.targetName = targetName;
	}

	public void setMessage(String message)
	{
		this.message = message;
	}

	public boolean isUseResource()
	{
		return useResource;
	}

	public void setUseResource(boolean useResource)
	{
		this.useResource = useResource;
	}
	/**
	 * @return Returns the timerForward.
	 */
	public int getTimer()
	{
		return timer;
	}
	/**
	 * 消息定时指定几秒钟跳转到指定的默认的forwardUrl
	 * @param timerForward The timerForward to set.
	 */
	public void setTimer(int timerForward)
	{
		this.timer=timerForward;
	}
	/**
	 * @return Returns the linkMsg.
	 */
	public String[] getLinkMsg()
	{
		return linkMsg;
	}
	/**
	 * @param linkMsg The linkMsg to set.
	 */
	public void setLinkMsg(String... linkMsg)
	{
		this.linkMsg=linkMsg;
	}
	/**
	 * @return Returns the isEnabledTimer.
	 */
	public boolean isEnabledTimer()
	{
		return isEnabledTimer;
	}
	/**
	 * @param isEnabledTimer The isEnabledTimer to set.
	 */
	public void setEnabledTimer(boolean isEnabledTimer)
	{
		this.isEnabledTimer=isEnabledTimer;
	}
	public String getResourceName()
	{
		return resourceName;
	}
	public void setResourceName(String resourceName)
	{
		this.resourceName = resourceName;
	}
	public String getMessageOnPageURL()
	{
		return messageOnPageURL;
	}
	public void setMessageOnPageURL(String url)
	{
		this.messageOnPageURL = url;
	}
	public int getMessageOnPageType()
	{
		return messageOnPageType;
	}
	public void setMessageOnPageType(int messageOnPageType)
	{
		this.messageOnPageType = messageOnPageType;
	}

}
